@echo off
set cur_dir=%cd%
set p2pcpp_home=%cd%\..

set version=p2pcpp_v1.2.6.win10

set release_dir=C:\Users\vi\git\release
set version_dir=%release_dir%\%version%

set git_dir=C:\Users\vi\git\p2pcpp_release\win10

cd %git_dir%
bash -c "git pull"

cd %p2pcpp_home%\build
cmake .. -DCMAKE_INSTALL_PREFIX=%version_dir%
make install

cmake .. -DCMAKE_INSTALL_PREFIX="C:/Users/vi/run"
xcopy /e /y /i C:\Users\vi\run\lib %version_dir%\lib

echo "version:%version%" > %version_dir%\etc\version.txt
echo "build date:%date% %time%" >> %version_dir%\etc\version.txt
echo "author:write by pack.bat" >> %version_dir%\etc\version.txt

cd %cur_dir%
cd %release_dir%
tar -zcf %version%.tar.gz .\%version%
copy  %version%.tar.gz %git_dir%

echo git dir: %git_dir%
echo "git cmd: git add %version%.tar.gz && git commit -m"add p2pcpp by pack.bat" && git push"
cd %git_dir%
bash -c "git add %version%.tar.gz"
bash -c "git commit -m"add p2pcpp by pack.bat""
bash -c "git push"
cd %cur_dir%
cd %cur_dir%


